import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//引入ElementPlus组件库相关内容
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

//引入ElementPlus图标库相关内容
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

//9.修改elementPlus默认中文
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'


//配置根路径
const BASE_URL='http://localhost:8080';
//window里面添加的内容是全局内容,我们可以在任意script标签内部使用
window.BASE_URL=BASE_URL;

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
//在VUE实例中也要添加全局内容,这样才能在template中使用
app.config.globalProperties.BASE_URL=BASE_URL;

app.use(ElementPlus,{ locale: zhCn }).use(store).use(router).mount('#app')

//定义获取用户信息的全局方法
window.getUser=()=>{
    return localStorage.user?JSON.parse(localStorage.user):null;
}
